home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1310 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: info.uah.edu!oreo!gbacon
  2. From: gbacon@oreo (Greg Bacon)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Strcat Doesn't work for this?
  5. Date: 13 Jan 1996 01:26:40 GMT
  6. Organization: The University of Alabama in Huntsville
  7. Message-ID: <4d71og$88a@info.uah.edu>
  8. References: <Pine.SOL.3.91.960111151925.25068C-100000@lore.cs.purdue.edu>
  9. NNTP-Posting-Host: oreo.aspire.cs.uah.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. ** Craig Cook ** (cookca@cs.purdue.edu) wrote:
  13. : Here is my excerpt of code in question:
  14.  
  15.  
  16. : Putword(int w, char *imageChar)
  17. : {
  18. :         w = (w & 0xff);
  19. :         strcat( imageChar, (const char *)w );
  20.  
  21. : }
  22.  
  23. : Why does it core dump?  It should work right?
  24.  
  25. : Craig                                 
  26. :                               ,,,
  27. :                              (o o)
  28. : -------------=={{ cookca@.cs.purdue.edu}}==-----------ooO-(_)-Ooo-------
  29.  
  30. There have been other suggestions, but is there enough storage allocated
  31. at the end of your imageChar array to hold the extra 4 (I'm assuming
  32. UNIX here) chars?  If not, that would cause a segmentation violation
  33. and, in turn, a core dump.
  34.  
  35. Greg
  36. --
  37. Greg Bacon <gbacon@cs.uah.edu>
  38. University of Alabama in Huntsville
  39. CS Department Systems Support Team
  40.